package com.goods.controller.business;


import com.goods.business.service.InStockService;
import com.goods.common.response.ResponseBean;
import com.goods.common.vo.business.InStockDetailVO;
import com.goods.common.vo.business.InStockItemVO;
import com.goods.common.vo.business.InStockVO;
import com.goods.common.vo.system.PageVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.websocket.server.PathParam;
import java.util.List;

@RestController
@RequestMapping("/business/inStock")
public class InStockController {

    @Autowired
    private InStockService inStockService;

    //加载表格数据
    @GetMapping("/findInStockList")
    //    queryMap: {pageNum: 1, pageSize: 10, status: 0},
    public ResponseBean<PageVO<InStockVO>> loadTableData(@RequestParam("pageNum") Integer pageNum,
                                                         @RequestParam("pageSize") Integer pageSize,
                                                         @RequestParam("status") Integer status,
                                                         InStockVO inStockVO){
        PageVO<InStockVO> pageVO = inStockService.loadTableData(pageNum,pageSize,status,inStockVO);
        return ResponseBean.success(pageVO);
    }

    //查看明细
    @GetMapping("/detail/{id}")
    public ResponseBean<List<InStockDetailVO>> detail(@PathVariable Long id, @RequestParam("pageNum") Integer pageNum){
        List<InStockDetailVO> inStockDetailVOList =  inStockService.detail(id,pageNum);
        return ResponseBean.success(inStockDetailVOList);
    }
}
